package com.wa.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 日志种类枚举
 * @Author Dawn
 * @Date 2021/10/19 10:38
 */
public enum LogCategoryEnum {
    CHANGE(10, "change", "变更日志"),
    OPERATION(20, "operation", "操作日志"),
    MSG(30, "message", "邮件/短信日志"),
    ;

    private int statusCode;
    private String statusMsgEn;
    private String statusMsgCn;

    private static final Map<Integer, LogCategoryEnum> lookup = new HashMap<>();

    static {
        for (LogCategoryEnum ase : LogCategoryEnum.values()) {
            lookup.put(ase.getStatusCode(), ase);
        }
    }

    LogCategoryEnum(int statusCode, String statusMsgEn, String statusMsgCn) {
        this.statusCode = statusCode;
        this.statusMsgEn = statusMsgEn;
        this.statusMsgCn = statusMsgCn;
    }

    public int getStatusCode() {
        return statusCode;
    }


    public String getStatusMsgEn() {
        return statusMsgEn;
    }

    public String getStatusMsgCn() {
        return statusMsgCn;
    }

    public static LogCategoryEnum get(Integer statusCode) {
        return lookup.get(statusCode);
    }

    @Override
    public String toString() {
        return this.statusMsgCn;
    }
}
